package com.chenxi.controller;

import com.chenxi.client.IUserCenterClient;
import com.chenxi.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class HomeController extends BaseController {


    @Autowired
    private IUserCenterClient userCenterClient;
    @RequestMapping(value = "/")
    public ModelAndView goHome(){

        return new ModelAndView("index");
    }

    @RequestMapping(value = "/page/{html}",method = RequestMethod.GET)
    public ModelAndView toMainPage(@PathVariable String html, HttpServletResponse response){

        return new ModelAndView("page/"+html);
    }

    @RequestMapping(value = "/page/{model}/{html}",method = RequestMethod.GET)
    public ModelAndView toPage(@PathVariable String model, @PathVariable String html, HttpServletResponse response){

        return new ModelAndView("page/"+model+"/"+html);
    }

    @GetMapping(value = "/revoke_token")
    public String revokeToken(){
        return userCenterClient.revokeToken();
    }
}
